# ##########################################
#	Setup some generics for the library:
# Normal and uppercase name of the library.
SET( LIB_NAME "Application" )
SET( LIB_UNAME "APPLICATION" )
SET( MAKE_UNITTEST OFF )

# Locations in the IDE project to place the
# library and tests.
SET( LIB_FOLDER "Libraries" )
SET( TEST_FOLDER "UnitTests" )


# ##########################################
#	List include files here.
SET( INCLUDE_FILES
	Include/Application/Application.hpp
	Include/Application/WindowedApp.hpp
	Include/Application/WindowManager.hpp
	Include/Application/RocketSystemInterface.hpp
	Include/Application/RocketRenderInterface.hpp
	Include/Application/Clock.hpp
	Include/Application/GameWindow.hpp
)


# ##########################################
#	List source files here.
SET( SOURCE_FILES
	Source/Application.cpp
	Source/WindowedApp.cpp
	Source/WindowManager.cpp
	Source/RocketSystemInterface.cpp
	Source/RocketRenderInterface.cpp
	Source/Clock.cpp
	Source/GameWindow.cpp
)


# ##########################################
#	List test files here.
SET( TEST_FILES
	Tests/TestAll.hpp
)


# ##########################################
#	No modifications needed past this point.
# ##########################################
# ##########################################
# Set file groupings here.
SOURCE_GROUP( "Includes" FILES ${INCLUDE_FILES} )
SOURCE_GROUP( "Source" FILES ${SOURCE_FILES} )


# ##########################################
#	Create the library.
ADD_LIBRARY( ${LIB_NAME}
	STATIC
	${INCLUDE_FILES}
	${SOURCE_FILES}
)
TARGET_INCLUDE_DIRECTORIES( ${LIB_NAME} PUBLIC ${CMAKE_CURRENT_LIST_DIR}/Include )
TARGET_COMPILE_DEFINITIONS( ${LIB_NAME} PRIVATE BUILDING_${LIB_UNAME} )
TARGET_LINK_LIBRARIES( ${LIB_NAME} Core FileSystem Config Script Math-SIMD UI TweakUtils RocketLua )


# ##########################################
# Group the libraries.
SET_PROPERTY( TARGET
	${LIB_NAME}
	PROPERTY FOLDER
	${LIB_FOLDER}
)


# ##########################################
# Make a unit test holder for the Math library.
IF( BUILD_UNIT_TESTS AND MAKE_UNITTEST )
	ADD_EXECUTABLE( _Test${LIB_NAME} Tests/Main.cpp ${TEST_FILES} )
	TARGET_LINK_LIBRARIES( _Test${LIB_NAME} ${LIB_NAME} GMock )

	ADD_TEST( NAME _Test${LIB_NAME} COMMAND _Test${LIB_NAME} )

	# ##########################################
	# Group the tests.
	SET_PROPERTY( TARGET _Test${LIB_NAME} PROPERTY FOLDER ${TEST_FOLDER} )
ENDIF()
